/*
 * Copyright 2017 Baiyyy
 * @(#)WorkingState.java
 */

package com.byyy.ccts.modules.ysjl.enums;

/**
 * 工作状态枚举
 */
public enum UserRadarEnum implements EnumInterface  {

    RADARONE(1, "手法"),
    RADARTWO(2, "球商"),
    RADARTHREE(3, "防守"),
    RADARFOUR(4, "妖娆"),
    RADARFIVE(5, "进攻"),
    RADARSIX(6, "跑动"),
    ;
    private int code;
    private String msg;

    private UserRadarEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static UserRadarEnum getEnumByCode(int code) {
        for (UserRadarEnum c : values()) {
            if (c.getCode() == code) {
                return c;
            }
        }
        return null;
    }

    public static String getMsgByCode(int code) {
        for (UserRadarEnum c : values()) {
            if (c.getCode() == code) {
                return c.getMsg();
            }
        }
        return null;
    }

    /**
     * getByMsg
     *
     */
    public static UserRadarEnum getByMsg(String msg) {
        for (UserRadarEnum c : values()) {
            if (c.msg.equals(msg)) {
                return c;
            }
        }
        return null;
    }

    public static Integer getCodeByMsg(String msg) {
        for (UserRadarEnum c : UserRadarEnum.values()) {
            if (c.msg.equals(msg)) {
                return c.code;
            }
        }
        return null;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }


    public String getKey() {
        return this.name();
    }
}
